import 'package:flutter/material.dart';
import 'package:flutterroom/pages/home/tab_search/dataList.dart';
import 'package:flutterroom/pages/home/widgets/common_image.dart';
import 'package:flutterroom/widgets/common_tag.dart';

class RoomListItemWidget extends StatelessWidget {
  final RoomListItemData data;

  const RoomListItemWidget(this.data, {Key key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return GestureDetector (
      onTap: (){
        Navigator.of(context).pushNamed("roomDetail/${data.id}");
      },
          child: Container(
        padding: EdgeInsets.only(left: 10, right: 10),
        child: Row(
          children: <Widget>[
            CommonImage(
              data.imageUri,
              width: 132,
              height: 100,
            ),
            Padding(padding: EdgeInsets.all(10)),
            Expanded(
                child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: <Widget>[
                Text(
                  data.title,
                  overflow: TextOverflow.ellipsis,
                  maxLines: 1,
                  style: TextStyle(fontWeight: FontWeight.w700, fontSize: 15),
                ),
                Text(
                  data.subTitle,
                  overflow: TextOverflow.ellipsis,
                  maxLines: 1,
                  style: TextStyle(fontSize: 13),
                ),
                Wrap(
                  children: data.tags.map((item) => CommonTag(item)).toList(),
                ),
                Text(
                  "${data.price} 元/月",
                  style: TextStyle(
                      color: Colors.orange,
                      fontSize: 16,
                      fontWeight: FontWeight.w700),
                )
              ],
            ))
          ],
        ),
      ),
    );
  }
}
